package com.codi.bus.core.service.util;

import com.codi.bus.core.service.model.DividendModel;
import lombok.extern.slf4j.Slf4j;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Created by asus on 2018/3/19.
 */
@Slf4j
public class CodeUtils {
    public static void SortDividend(List<DividendModel> dividendModels){
        Collections.sort(dividendModels, new Comparator<DividendModel>() {
            @Override
            public int compare(DividendModel o1, DividendModel o2) {
                String o1No = o1.getDividendDate(), o2No = o2.getDividendDate();
                if (o1No.length() < o2No.length()) {
                    return 1;
                } else if (o1No.length() > o2No.length()) {
                    return -1;
                }
                return 0 - o1No.compareTo(o2No);
            }
        });
    }
}
